import { useCallback, useState } from 'react';

/**
 * @desc 调用则会更新当前作用的render,为了主动更新特定的组件
 */
export function useExtraDepState(value?: number) {
  const [bool, setBool] = useState(value);

  const update = useCallback((value?: number) => {
    setBool(value ?? Math.random() + Math.random() * 10);
  }, []);

  return [bool, update] as [typeof bool, typeof update];
}
